﻿using System;
using System.Diagnostics;
using System.Linq;

namespace Approach2
{
    class Program
    {
        private const int maxResult = 100; 

        static void Main()
        {
            var stopwatch = new Stopwatch();
            stopwatch.Start();

            var sumOfSquares = Enumerable.Range(1, maxResult).Select(x => x*x).Sum();
            var squareOfSums = Math.Pow(Enumerable.Range(1, maxResult).Sum(), 2);

            stopwatch.Stop();

            Console.WriteLine(squareOfSums - sumOfSquares);
            Console.WriteLine("Execution time: {0}ms", stopwatch.ElapsedMilliseconds);

            Console.ReadKey();
        }
    }
}
